unit uFrmEMailing;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ComCtrls, Grids;

type
  TFrmEMailing = class(TForm)
    mem_Mail: TMemo;
    btn_SendMail: TButton;
    stg_PersonMail: TStringGrid;
    Label13: TLabel;
    Label4: TLabel;
    procedure stg_PersonMailDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
    procedure stg_PersonMailSelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);
  private
    { Private declarations }
    procedure PopulatePlayersMails();
  public
    { Public declarations }
    procedure SetData();
  end;

var
  FrmEMailing: TFrmEMailing;

implementation

uses uFrmMain;
{$R *.dfm}
{ TFrmEMailing }

procedure TFrmEMailing.PopulatePlayersMails;
begin
  FrmMain.GetGridData(stg_PersonMail, 'SELECT ID, NAME||'' ''||SURNAME AS PLAYER, EMAIL FROM PLAYERS WHERE CAN_MAIL=1', true);
end;

procedure TFrmEMailing.SetData;
begin
  PopulatePlayersMails();
  Show();
end;

procedure TFrmEMailing.stg_PersonMailDrawCell(Sender: TObject; ACol, ARow: Integer; Rect: TRect; State: TGridDrawState);
begin
  FrmMain.GridDrawCell(Sender, ACol, ARow, Rect, State);
end;

procedure TFrmEMailing.stg_PersonMailSelectCell(Sender: TObject; ACol, ARow: Integer; var CanSelect: Boolean);
begin
  stg_PersonMail.Refresh;
end;

end.
